package util;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Game {
    private static Game instance = new Game();
    private List<Integer> digits;
    private Set<String> solution = new HashSet<String>();//记录本次24点的答案

    private Game() {
        digits = new ArrayList<>();
        for (int i = 1; i <= 9; i++) {
            digits.add(i);
        }

    }

    public static Game getInstance() {
        return instance;
    }

    public Set<String> getSolution() {
        return solution;
    }

    public void setSolution(Set<String> solution) {
        this.solution = solution;
    }


    public Integer getDigitAt(int pos) {
        return digits.get(pos);
    }

    public boolean setDigitAt(int pos, Integer newValue) {
        if (pos < 0 || pos >= digits.size())
            return false;

        digits.set(pos, newValue);
        return true;
    }

    public List<Integer> getDigits() {
        return digits;
    }
}
